﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnliQ.Service.Contracts;

namespace UnliQ.Data.Repositories
{
    public class FakeUserRepo : IUsersRepo
    {

        private List<UserDTO> _users = null;
       

        #region [Constructor(s)]
        public FakeUserRepo()
        {


        }
        #endregion

        public void AddInitUsers(List<UserDTO> users)
        {
            _users = users;
  
        }

        public UserDTO Get(int id)
        {
            throw new NotImplementedException();
        }

        public List<UserDTO> GetList()
        {

            return _users;

        }

        public int Insert(UserDTO value)
        {
            throw new NotImplementedException();
        }

        public void Update(UserDTO value)
        {
            throw new NotImplementedException();
        }

        public void Delete(int id)
        {
            throw new NotImplementedException();
        }


        public void UpdateUserRoles(UserDTO user)
        {
            throw new NotImplementedException();
        }

        public string GetName(int userId)
        {
            return _users.Where(w => w.UserId == userId).Select(s => s.Username).FirstOrDefault();
        }

        public int GetId(string userName)
        {
            return _users.Where(w => w.Username.ToLower() == userName.ToLower()).Select(s => s.UserId).FirstOrDefault();
        }

        public List<string> GetUsernames(List<int> userIds)
        {
            return _users.Where(w => userIds.Contains(w.UserId)).Select(s => s.Username).ToList();
        }
    }



}
